#ifndef __ChatterBoxServer_H__
#define __ChatterBoxServer_H__

#include <QStringList>
#include <QTcpServer>
#include <QTcpSocket>
#include <QMap>
#include <QSet>

class QTextStream;
class QFile;

class ChatterBoxServer : public QTcpServer
{
	Q_OBJECT

	public:
		ChatterBoxServer(QObject *parent=0);
		~ChatterBoxServer();

	private slots:
		void readyRead();
		void disconnected();
		void sendUserList();

	protected:
		void incomingConnection(int socketfd);

	private:
		void						log(const QString&);

		QSet<QTcpSocket*>			clients;
		QMap<QTcpSocket*,QString>	users;
		QTextStream*				m_pLog;
		QFile*						m_pLogFile;
};

#endif
